﻿using ArrayListTeat;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ArrayListTeat
{
    class Program
    {
        static void Main(string[] args)
        {  //查找元素
            ArrayList arr = new ArrayList() { "明天要下雨", "love", 521, 666, 100 };
            int index = arr.IndexOf("love");
            if(index != -1)
            {
                Console.WriteLine("集合中存在love元素");
            }else
            {
                Console.WriteLine("集合中不存在love元素");
            }
            //添加元素
            ArrayList insertList = new ArrayList() { "我", "爱", "你" };
            arr.InsertRange(1, insertList);
            foreach (var v in arr) 
            { 
                Console.Write(v+","); 
            }
            //排序元素
            ArrayList list = new ArrayList() { "aaa", "bbb", "abc" };
            list.Sort(); 
            foreach (var v in list) 
            { 
                Console.WriteLine(v);
            }
        }
    }
    }
